/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.B030;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class B030Store extends B030 {

    public List<B030> getListB030L(int pnFH000, int pnFH200, int pnFB050, int pnFN100, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_B030L, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFB050),
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, B030.class);
    }

    public List<B030> getListB030R(int pnFH000, int pnFH200, int pnFB050, int pnFN100, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_B030R, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFB050),
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, B030.class);
    }

    public int updateB030(int pnFH000, int pnFH200, int pnFB050, int pnFN100, int pnBN031, String pvBV032, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_B030, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFB050),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnBN031),
                        new Param(OracleTypes.CHAR, pvBV032),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, B030.class);
        } catch (SQLException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

    public int deleteB030(int pnFB050, int pnFN100, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_B030, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFB050),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return update(dataStatement, B030.class);
        } catch (SQLException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

    public List<B030> getListCombB030N(int pnFH000,
            int pnFH200,
            int pnFB050,
            int pnFN100,
            String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_COMBB030N, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFB050),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, B030.class);
        } catch (SQLException ex) {
            Logger.getLogger(B030Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(B030Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(B030Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

    }
}
